﻿
@{
    Layout = null;
}

<!DOCTYPE html>

<html>
<head>
    <meta name="viewport" content="width=device-width" />
    <title>Index</title>
    <script src="~/Script/jquery.js"></script>
    <script src="~/Script/jquery.validate.js"></script>
</head>
<body>
    <div>
        @using (Html.BeginForm())
        {
            <p>用户名：@Html.TextBox("username")</p>
            <p>密码：@Html.Password("pwd")</p>
            <p>确认密码：@Html.Password("pwd1")</p>
            <p><input type="submit" value="登录" /></p>
        }


         @using (Html.BeginForm())
    {
        <p>姓名：@Html.TextBox("Name")</p>
        <p>年龄：@Html.TextBox("Age")</p>
        <p>身高：@Html.TextBox("Height")</p>
        <p>生日：@Html.TextBox("Birthday")</p>
        <p>邮箱：@Html.TextBox("Email")</p>
        <p><input type="submit" value="提交" /></p>
        @Html.ValidationSummary();
    }
    </div>

   
    <script>
        $(document).ready(function () {
            $("form").validate({
                rules: {
                    username: { required: true },
                    pwd: { required: true },
                    pwd1: { required: true, equalTo: "#pwd" },

                }, messages: {
                    username: { required: "请输入用户名" },
                    pwd: { required: "请输入密码" },
                    pwd1: { required: "<span style='color:red'>请输入密码</span>", equalTo: "密码不一致" },
                }

            })

        })
    </script>
</body>
</html>
